import Vue from 'vue';
import App from './App.vue';
import router from './routes';
import store from './store';
import { Lazyload } from 'vant';

Vue.config.productionTip = false;

Vue.use(Lazyload);

// Vuex仓库初始化，从 localStorge 读取数据
// store.dispatch('initStoreForLocalStorage');

// 定义全局日期时间过滤器
Vue.filter('dateFormat', function (dateStr) {
	let date = new Date(dateStr);
	let y = date.getFullYear();
	let m = (date.getMonth() + 1).toString().padStart(2, '0');
	let d = date.getDate().toString().padStart(2, '0');
	let h = date.getHours().toString().padStart(2, '0');
	let mi = date.getMinutes().toString().padStart(2, '0');
	let s = date.getSeconds().toString().padStart(2, '0');
	return `${y}-${m}-${d} ${h}:${mi}:${s}`;
});

new Vue({
	render: h => h(App),
	router,
	store
}).$mount('#app');
